#pragma once

#include "apdu.h"
#include "apdu_mgr_base.h"

class apdu_rsa_manager : public apdu_mgr_base
{
public:
	apdu_rsa_manager(void);
	~apdu_rsa_manager(void);

public:
	
	apdu * create_apdu_gen_rsa_keypair(int app_id, int container_id, int modulus_len);
	
	apdu * create_apdu_import_rsa_keypair_head( int app_id, int container_id, unsigned long sym_alg_id, 
								unsigned long wrap_key_len, unsigned char * wrap_key,
								unsigned long key_bits_len, unsigned long encrypted_data_len);

	apdu * create_apdu_rsa_sign_data(int app_id, int container_id, int input_mode, int hash_algo, 
								unsigned char * input_data, int data_len);


	apdu * create_apdu_rsa_verify(int input_mode, int hash_algo, unsigned char * pub_key_blob, int pub_key_len,
								unsigned char * input_data, unsigned long data_len, 
								unsigned char * signature, int sig_len );

	apdu * create_apdu_rsa_export_session_key( int app_id, int container_id, unsigned long alg_id,
										unsigned char * pub_key_blob, unsigned long pub_key_len );

	apdu * create_apdu_rsa_export_session_key_ex(int app_id, int container_id, int session_key_id,
										unsigned char * pub_key_blob, int pub_key_len);

	apdu * create_apdu_ext_rsa_pubkey_operation(unsigned char * pub_key_blob, int pub_key_len, 
										unsigned char * input_data, int data_len);

	apdu * create_apdu_ext_rsa_encrypt(unsigned char * pub_key_blob, int pub_key_len,
									unsigned char * input_data, int data_len);


	apdu * create_apdu_rsa_public(int app_id, int container_id, int key_spec, unsigned char * input_data, int data_len);
	
	apdu * create_apdu_rsa_private(int app_id, int container_id, int key_spec, unsigned char * input_data, int data_len);

	apdu * create_apdu_rsa_encrypt(int app_id, int container_id, int key_spec, unsigned char * input_data, int data_len);

	apdu * create_apdu_rsa_decrypt(int app_id, int container_id, int key_spec, unsigned char * input_data, int data_len);

	apdu * create_apdu_rsa_sign_ex(int app_id, int container_id, int key_spec, int hash_algo, unsigned char * input_data, int data_len);

	apdu * create_apdu_rsa_sign_interactive(int app_id, int container_id, int key_spec, int hash_algo, 
								int timeout, unsigned char * input_data, int data_len);

	apdu * create_apdu_rsa_sign_interactive_cancel(int app_id, int container_id, int key_spec, int hash_algo);

	apdu * create_apdu_rsa_verify_ex(int app_id, int container_id, int key_spec, int hash_algo, 
								unsigned char * input_data, int data_len, unsigned char * signature, int sig_len);

	apdu * create_apdu_import_ext_rsa_keypair_head(int app_id, int container_id, int key_spec);

	apdu * create_apdu_delete_keypair(int app_id, int container_id, int key_spec);

	apdu * create_apdu_delete_certificate(int app_id, int container_id, int key_spec);

	apdu * create_apdu_gen_rsa_keypair_ex(int app_id, int container_id, int key_spec, int bit_len);

	apdu * create_apdu_gen_ext_rsa_keypair(int bits);

	apdu * create_apdu_export_ext_rsa_pub_key();

	apdu * create_apdu_import_ext_rsa_keypair_to_ram(unsigned char * keypair_blob, int blob_len);

	apdu * create_apdu_ram_rsa_operation( int mode, unsigned char * data, int data_len );
private:
};
